import myAxios from '@/request.ts'

/**
 * 用户登录
 * @param params
 */
export const userLogin = async (params: unknown) => {
  return await myAxios.request<never,never>({
    url: '/user/login',
    method: 'POST',
    data: params,
  })
}

/**
 * 用户注册
 * @param params
 */
export const userRegister = async (params: unknown) => {
  return await myAxios.request({
    url: '/user/register',
    method: 'POST',
    data: params,
  })
}

/**
 * 当前用户
 */
export const currentUser = async () => {
  return await myAxios.request<never,never>({
    url: '/user/current',
    method: 'GET',
    headers: {
      authorization: localStorage.getItem('authorization')
    }
  })
}
